package com.fsoft.finaltest.controller;


import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * Handles requests for the application indexs page.
 */
@Controller
public class MainController {

	@RequestMapping(value = "/", method = RequestMethod.GET)
	public String doIndex(Model model) {
		model.addAttribute("URL", "resources/");

		return "index";
	}

	@RequestMapping(value = "/submit", method = RequestMethod.POST)
	public String doSubmit(Model model) {

		model.addAttribute("msg", "{\"error\": 0, \"msg\": \"Sorry, I can't eat this food\"}");
		model.addAttribute("msg", "{\"error\": 0, \"msg\": \"Thanks, I'm full already!\"}");
		model.addAttribute("msg", "{\"error\": 0, \"msg\": \"OK, I'm eating now...\"}");
		
		return "submit";
	}

}
